package iotest.practice;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("gouzi.jpg");
        FileOutputStream fos = new FileOutputStream("gougouzi.jpg");

        byte[] data = new byte[1024];
        int len;
        long start = System.currentTimeMillis();
        while ((len = fis.read(data)) != -1) {
            fos.write(data,0,len);

        }
        long end = System.currentTimeMillis();
        fis.close();
        fos.close();
        System.out.println("写完了,耗时:" + (end - start) + "ms");


    }
}
